package com.yuexinduo.loginmodule;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.gyf.immersionbar.ImmersionBar;
import com.yuexinduo.baselibrary.base.BaseMvpActivity;


@Route(path = "/loginmodule/LoginActivity")
public class LoginActivity extends BaseMvpActivity implements View.OnClickListener {
    private EditText loginPhone;
    private EditText loginCode;
    private TextView loginGain;
    private Button loginSure;
    private TextView loginPass;
    private TextView loginRegister;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        loginSure.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(getActivity(),ChangedPassActivity.class));
            }
        });
    }
    @Override
    protected void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this)
                .fitsSystemWindows(true)  //使用该属性,必须指定状态栏颜色
                .statusBarColor(R.color.white)
                .init();
    }
    @Override
    protected int bindLayout() {
        return R.layout.activity_login;
    }

    @Override
    protected Activity getActivity() {
        return this;
    }

    @Override
    protected void initCreate() {
        loginPhone = (EditText) findViewById(R.id.login_phone);
        loginCode = (EditText) findViewById(R.id.login_code);
        loginGain = (TextView) findViewById(R.id.login_gain);
        loginSure = (Button) findViewById(R.id.login_sure);
        loginPass = (TextView) findViewById(R.id.login_pass);
        loginRegister = (TextView) findViewById(R.id.login_register);
        loginSure.setOnClickListener(this);
        loginPass.setOnClickListener(this);
        loginRegister.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        int id = v.getId();
        if (id == R.id.login_sure) {
            ARouter.getInstance()
                    .build("com.yuexinduo.education.ui.MainActivity")
//                        .withInt("i", i)
                    .navigation();
//                startActivity(new Intent(getActivity(),MainActivity.class));
        } else if (id == R.id.login_pass) {
        } else if (id == R.id.login_register) {
            startActivity(new Intent(getActivity(), RegisterUserActivity.class));
        }
    }
}